﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AlertDetailPage.ascx.cs"
    Inherits="Workflow.Alerts.Sublayout.AlertDetailPage" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="MaterialsGrid.ascx" TagPrefix="mg" TagName="MaterialGrid" %>
<div runat="server" id="details" class="detailBox">
    <div class="detailSummaryBox floatLeft">
        <div runat="server" id="dtlsTable" class="detailsContainer">
            <div class="boxRow firstBoxRow">
                <span runat="server" id="Alerttype" class="floatLeft" visible="false">
                    <asp:Label ID="lblAlertType" runat="server" CssClass="alertType" />
                </span><span runat="server" id="Code" class="floatRight" visible="false">
                    <asp:Label ID="lblCode" runat="server" CssClass="alertCode" />
                </span>
            </div>
            <div runat="server" id="Location" class="boxRow" visible="false">
                <h2>
                    <asp:Label ID="lblLocation" runat="server" /></h2>
            </div>
            <div runat="server" id="ActivityType" class="boxRow" visible="false">
                <span class="rowBoxLabel">Activiteit</span><asp:Label ID="lblActivityType" runat="server" />
            </div>
            <div runat="server" id="Area" class="boxRow" visible="false">
                <span class="rowBoxLabel">Oppervlakte</span><asp:Label ID="lblArea" runat="server" />m<sup>2</sup>
            </div>
            <div runat="server" id="NetworkOperatorName" class="boxRow" visible="false">
                <span class="rowBoxLabel">Contactgegevens</span><asp:Label ID="lblNetworkOperatorName"
                    runat="server" />
            </div>
            <div runat="server" id="ContractorName" class="boxRow" visible="false">
                <span class="rowBoxLabel">Uitvoerder</span><asp:Label ID="lblContractorName" runat="server" />
            </div>
            <div class="boxRow alertDates" runat="server">
                <div runat="server" id="CreationDate" class="alertDate floatLeft" visible="false">
                    <span class="rowBoxLabel">aanvraag</span>
                    <asp:Label ID="lblCreationDate" runat="server" CssClass="dateLabel" />
                </div>
                <div runat="server" id="EstimateStartDate" class="alertDate floatLeft" visible="false">
                    <span class="rowBoxLabel">start</span>
                    <asp:Label ID="lblEstimateStartDate" runat="server" CssClass="dateLabel" />
                </div>
                <div runat="server" id="EstimateEndDate" class="alertDate floatLeft" visible="false">
                    <span class="rowBoxLabel">gereed</span>
                    <asp:Label ID="lblEstimateEndDate" runat="server" CssClass="dateLabel" />
                </div>
            </div>
            <div runat="server" id="Traffic" class="boxRow" visible="false">
                <asp:UpdatePanel ID="upTrafficCheck" runat="server" UpdateMode="Always">
                    <ContentTemplate>
                        <asp:CheckBox runat="server" ID="isTraffic" CssClass="checkBoxLabel disabled" Enabled="false"
                            Text="Verkeershinder verwacht" />
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
        </div>
        <div class="buttonBlock" runat="server">
            <div class="review tag_review" id="ReviewButtons" runat="server" visible="false">
                <span class="reviewStatus tag_reviewStatus" id="btnAlertApprove" runat="server">Beoordelen</span>
                <div class="choices tag_choices">
                    <div class="choicesBoxTop">
                        <div class="clear">
                        </div>
                        <input id="btnReject" type="button" class="js_reject styledButton reviewRejected"
                            value="Niet akkoord" />
                        <input id="btnPartApprove" type="button" class="js_partApprove styledButton reviewPartApproved"
                            value="Akkoord onder voorbehoud" />
                        <asp:Button ID="btnApprove" runat="server" Text="Akkoord" CommandName="Approve" OnCommand="btnClick_Command"
                            CssClass="js_approve styledButton reviewApproved" />
                        <asp:Button ID="btnClearReview" runat="server" Text="Beoordeling verwijderen" CommandName="ClearReview"
                            OnCommand="btnClick_Command" CssClass="styledButton" />
                        <input type="button" class="js_cancel styledButton reviewCancel" value="Annuleren" />
                        <div class="clear">
                        </div>
                    </div>
                    <div class="choicesBoxFooter">
                    </div>
                </div>
            </div>
            <div class="accept review tag_review" id="ExecuteButtons" runat="server" visible="false">
                <span class="reviewStatus tag_reviewStatus" id="btnAlertExecute" runat="server">Beoordelen</span>
                <div class="choices tag_choices">
                    <div class="choicesBoxTop">
                        <div class="clear">
                        </div>
                        <input id="Button2" type="button" class="js_decline styledButton reviewRejected"
                            value="Afkeuren" />
                        <input id="Button1" type="button" class="js_executed2 styledButton reviewPartApproved"
                            value="Akkoord onder voorwaarde" />
                        <asp:UpdatePanel ID="upButtonsExecute" runat="server" UpdateMode="Always">
                            <ContentTemplate>
                                <asp:Button ID="btnAccept" runat="server" CssClass="js_accept styledButton reviewApproved edit"
                                    Text="Goedkeuren" />
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <asp:Button ID="Button4" runat="server" Text="Beoordeling verwijderen" CommandName="ClearReview"
                            OnCommand="btnClick_Command" CssClass="styledButton " />
                        <input type="button" class="js_cancel styledButton reviewCancel" value="Annuleren" />
                        <div class="clear">
                        </div>
                    </div>
                    <div class="choicesBoxFooter">
                    </div>
                </div>
            </div>
            <div class="tag_execute review tag_review" id="InProgressButtons" runat="server"
                visible="false">
                <span class="reviewStatus tag_reviewStatus">Gereed melden</span>
                <div class="choices tag_choices">
                    <div class="choicesBoxTop">
                        <div class="clear">
                        </div>
                        <input type="button" class="js_executed styledButton reviewApproved" value="Uitgevoerd" />
                        <input type="button" class="js_cancel styledButton reviewCancel" value="Annuleren" />
                        <div class="clear">
                        </div>
                    </div>
                    <div class="choicesBoxFooter">
                    </div>
                </div>
            </div>
            <div class="clear">
            </div>
            <div class="redivacted" runat="server" id="RetrackedButtons" visible="false">
                <asp:Button ID="btnRetracted" runat="server" Text="Retracted" />
            </div>
            <div class="clear">
            </div>
            <div id="DivMeldingTerugNaarFacturatie" runat="server" visible="false" class="meldingTerugNaarFacturatie">
                <asp:Button ID="btnMeldingTerugNnaarFacturatie" runat="server" Text="Melding terug naar facturatie"
                    CommandName="MeldingTerugNaarFacturatie" OnCommand="btnClick_Command" CssClass="js_approve styledButton reviewApproved" />
            </div>
            <div id="DivOpslaanVerzenden" runat="server" visible="false" class="opslaanEnVerzenden">
                <asp:Button ID="btnOpslaanVerzenden" runat="server" Text="Opslaan en verzenden" CommandName="OpslaanVerzenden"
                    OnCommand="btnClick_Command" CssClass="js_approve styledButton styledButton150 reviewApproved" />
            </div>
            <div class="summary">
                <span id="DivGereedMelden" runat="server" visible="false">
                    <asp:Button ID="btnGereedMelden" runat="server" Text="Gereed Melden" OnClick="btnGereedMelden_OnClick"
                        CssClass="styledButton styledButton150" />
                </span>
                <asp:Button ID="btnSummary" runat="server" Text="Details" CssClass="styledButton showHideDetails tag_showHideDetails"
                    OnClick="btnSummary_Click" />
            </div>
            <input id="MunicipalityName" type="hidden" runat="server" />

            <script type="text/javascript">
                workflow.review.Init("div.tag_review", document.getElementById("<%= MunicipalityName.ClientID %>").value)
            </script>

        </div>
    </div>
    <div class="detailExtendedBox tag_detailExtendedBox floatLeft">
        <div runat="server" id="summary">
            <dl class="detailExtended" id="DetailExtended">
                <dt class="boxRow" id="dtNetworkOperatorInfo" runat="server">Contactgegevens</dt>
                <dd runat="server" id="NetworkOperatorInfo" class="dataNetbeheerder" visible="false">
                    <div runat="server" id="SummaryNetworkOperatorName" class="boxRow" visible="false">
                        <span class="rowBoxLabel">Contactgegeven</span>
                        <asp:Label ID="lblNetworkOperatorNameSummary" runat="server" />
                    </div>
                    <div runat="server" id="NetworkOperatorAddress" class="boxRow" visible="false">
                        <span class="rowBoxLabel">Adres</span>
                        <asp:Label ID="lblNetworkOperatorAddress" runat="server" />
                    </div>
                    <div runat="server" id="NetworkOperatorPerson" class="boxRow" visible="false">
                        <span class="rowBoxLabel">Contactpersoon</span>
                        <asp:Label ID="lblNetworkOperatorPerson" runat="server" />
                    </div>
                    <div runat="server" id="NetworkOperatorEmail" class="boxRow" visible="false">
                        <span class="rowBoxLabel">E-mail</span>
                        <asp:HyperLink ID="hlNetworkOperatorEmail" runat="server" />
                    </div>
                    <div runat="server" id="NetworkOperatorTel" class="boxRow" visible="false">
                        <span class="rowBoxLabel">Telefoon</span>
                        <asp:Label ID="lblNetworkOperatorTel" runat="server" />
                    </div>
                </dd>
                <dt>Uitvoerder</dt>
                <dd runat="server" id="ContractorInfo" class="dataUitvoerder" visible="false">
                    <div runat="server" id="SummaryContractorName" class="boxRow dropDownRow" visible="false">
                        <span class="rowBoxLabel">Uitvoerder</span>
                        <asp:DropDownList ID="ddlContractorName" runat="server" OnSelectedIndexChanged="ddlContractorName_SelectedIndexChanged"
                            AutoPostBack="true" CssClass="hiddenDropdown js_hiddenDropdown styledDropdown160">
                        </asp:DropDownList>
                    </div>
                    <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="3">
                        <ProgressTemplate>
                            <div class="progress">
                                Updating&hellip;</div>
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                    <asp:UpdatePanel ID="upContractorInfo" runat="server" UpdateMode="Always">
                        <ContentTemplate>
                            <div runat="server" id="ContractorPerson" class="boxRow" visible="false">
                                <span class="rowBoxLabel">Contactpersoon</span>
                                <asp:Label ID="lblContractorPerson" runat="server" />
                            </div>
                            <div runat="server" id="ContractorEmail" class="boxRow" visible="false">
                                <span class="rowBoxLabel">E-mail</span>
                                <asp:HyperLink ID="hlContractorEmail" runat="server" />
                            </div>
                            <div runat="server" id="ContractorTel" class="boxRow" visible="false">
                                <span class="rowBoxLabel">Telefoon</span>
                                <asp:Label ID="lblContractorTel" runat="server" />
                            </div>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ddlContractorName" EventName="SelectedIndexChanged" />
                        </Triggers>
                    </asp:UpdatePanel>
                </dd>
                <dt class="boxRow" id="dtActualData" runat="server">Uitvoering</dt>
                <dd runat="server" id="ActualData" class="dataUitvoering" visible="false">
                    <div id="ActivityType" class="boxRow" class="activityType">
                        <span class="rowBoxLabel">Activiteit</span>
                        <asp:DropDownList ID="ddlActivityType" runat="server" OnSelectedIndexChanged="ddlActivityType_SelectedIndexChanged"
                            AutoPostBack="true" CssClass="hiddenDropdown js_hiddenDropdown styledDropdown160">
                        </asp:DropDownList>
                    </div>
                    <div runat="server" id="ActualArea" class="boxRow">
                        <span class="rowBoxLabel">Werkelijke oppervlakte</span>
                        <telerik:RadNumericTextBox ID="txtActualArea" runat="server" CssClass="styledInput styledInput180"
                            ShowSpinButtons="false" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                            MinValue="0" MaxValue="15" OnTextChanged="txtActualArea_ValueChanged" NumberFormat-DecimalDigits="0"
                            EnableEmbeddedBaseStylesheet="False" EnableEmbeddedSkins="False" Skin="workflow"
                            Width="162px" />
                    </div>
                    <div runat="server" id="ActualStartDate" class="boxRow" visible="false">
                        <div class="actualDateContainer floatLeft">
                            <asp:Label ID="Label2" runat="server" CssClass="rowBoxLabel" Text="Definitieve start datum" />
                            <telerik:RadDatePicker ID="rdpStartDate" runat="server" EnableEmbeddedBaseStylesheet="False"
                                EnableEmbeddedSkins="False" Skin="workflow" OnSelectedDateChanged="rdpStartDate_SelectedDateChanged"
                                AutoPostBack="true">
                                <Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x">
                                </Calendar>
                                <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
                                <DateInput DisplayDateFormat="d-M-yyyy" DateFormat="d-M-yyyy" AutoPostBack="True">
                                </DateInput>
                            </telerik:RadDatePicker>
                            <asp:RequiredFieldValidator Display="Dynamic" ID="rvfStartDate" ControlToValidate="rdpStartDate"
                                runat="server" ErrorMessage="RequiredFieldValidator" />
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <div runat="server" id="ActualEndDate" class="boxRow" visible="false">
                        <div class="actualDateContainer floatLeft">
                            <asp:Label ID="Label3" runat="server" CssClass="rowBoxLabel" Text="Definitieve eind datum" />
                            <telerik:RadDatePicker ID="rdpEndDate" runat="server" EnableEmbeddedBaseStylesheet="False"
                                EnableEmbeddedSkins="False" Skin="workflow" OnSelectedDateChanged="rdpEndDate_SelectedDateChanged"
                                AutoPostBack="true">
                                <Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x">
                                </Calendar>
                                <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
                                <DateInput DisplayDateFormat="d-M-yyyy" DateFormat="d-M-yyyy" AutoPostBack="True">
                                </DateInput>
                            </telerik:RadDatePicker>
                            <asp:RequiredFieldValidator Display="Dynamic" ID="rvfEndDate" ControlToValidate="rdpEndDate"
                                runat="server" ErrorMessage="RequiredFieldValidator" />
                            <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Definitieve einddatum kan niet eerder zijn dan startdatum"
                                Operator="GreaterThanEqual" ControlToValidate="rdpEndDate" ControlToCompare="rdpStartDate"
                                Type="Date" Display="Dynamic" />
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <asp:UpdatePanel ID="upActualData" runat="server">
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="txtActualArea" EventName="TextChanged" />
                            <asp:AsyncPostBackTrigger ControlID="rdpStartDate" EventName="selecteddatechanged" />
                            <asp:AsyncPostBackTrigger ControlID="rdpEndDate" EventName="selecteddatechanged" />
                            <asp:AsyncPostBackTrigger ControlID="ddlActivityType" EventName="SelectedIndexChanged" />
                        </Triggers>
                    </asp:UpdatePanel>
                </dd>
                <dt id="dtMaterialsDataInfo" runat="server">Gebruikte materialen - Kosten: <span
                    class="materialCost">
                    <asp:UpdatePanel ID="updMaterialsSum" runat="server" UpdateMode="Always" RenderMode="Inline">
                        <ContentTemplate>
                            &euro;
                            <asp:Literal ID="ltMaterialsSum" runat="server" />
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="mgList" EventName="PriceUpdated" />
                        </Triggers>
                    </asp:UpdatePanel>
                </span></dt>
                <dd runat="server" id="MaterialsDataInfo" class="dataMaterialen" visible="false">
                    <mg:MaterialGrid ID="mgList" runat="server"></mg:MaterialGrid>
                </dd>
                <dt id="dtCommentsInfo" runat="server">Opmerkingen</dt>
                <dd runat="server" id="CommentsInfo" class="dataOpmerkingen" visible="false">
                    <div runat="server" id="Comments" class="boxRow">
                        <p>
                            Voeg hier een extra opmerking toe:</p>
                        <asp:UpdateProgress ID="UpdateProgress3" runat="server" DisplayAfter="3">
                            <ProgressTemplate>
                                <div class="progress">
                                    Updating&hellip;</div>
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                        <asp:UpdatePanel runat="server" ID="updComments">
                            <ContentTemplate>
                                <asp:TextBox ID="txtComments" runat="server" TextMode="MultiLine" />
                                <asp:Button ID="btnSaveRemark" runat="server" OnClick="btnSaveRemark_Click" Text="Opslaan"
                                    CssClass="styledButton styledButton75 floatLeft" />
                                <div class="remarklist">
                                    <asp:Repeater ID="rptComments" runat="server" OnItemDataBound="rptComments_ItemDataBound"
                                        OnItemCommand="rptComments_ItemCommand">
                                        <ItemTemplate>
                                            <asp:Label ID="lblId" runat="server" Text='<%#Eval("id")%>' Visible="false"></asp:Label>
                                            <div class="tag_remark">
                                                <p class="meta">
                                                    <strong>
                                                        <%# Eval("name") %>
                                                        [<%# Eval("organizationname") %>]</strong> <small>
                                                            <%# Eval("date") %></small>:
                                                    <asp:Button ID="btnEdit" runat="server" Visible="false" Text="Edit" UseSubmitBehavior="false"
                                                        CssClass="edit" />
                                                </p>
                                                <p class="comment">
                                                    <%# Eval("comments") %>
                                                </p>
                                                <div class="comment_edit" style="display: none;" id="txtCommentBox" runat="server">
                                                    <asp:TextBox ID="txtComment" runat="server" TextMode="MultiLine" Text='<%#Eval("comments")%>'></asp:TextBox>
                                                    <asp:Button ID="btnUpdate" runat="Server" Text="Update" CommandName="UpdateRemark"
                                                        CssClass="styledButton styledButton75 floatLeft" />
                                                </div>
                                            </div>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                </div>
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="btnSaveRemark" EventName="Click" />
                            </Triggers>
                        </asp:UpdatePanel>
                    </div>
                </dd>
                <dt id="dtTrafficCommentsInfo" runat="server">Verkeershinder</dt>
                <dd runat="server" id="TrafficCommentsInfo" class="dataVerkeershinder">
                    <div runat="server" id="TrafficComments" class="boxRow">
                        <p>
                            Voeg hier een extra verkeershinder opmerking toe:</p>
                        <asp:UpdateProgress ID="UpdateProgress4" runat="server" DisplayAfter="3">
                            <ProgressTemplate>
                                <div class="progress">
                                    Updating&hellip;</div>
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                        <asp:UpdatePanel runat="server" ID="UpdatePanel1">
                            <ContentTemplate>
                                <asp:CheckBox ID="chkTraffic" runat="server" AutoPostBack="true" OnCheckedChanged="chkTraffic_CheckedChanged"
                                    CssClass="checkBoxLabel" Text="Verkeershinder verwacht" />
                                <asp:TextBox ID="txtTrafficComments" runat="server" TextMode="MultiLine" />
                                <asp:Button ID="btnAddTrafficComments" runat="server" OnClick="btnSaveTrafficComment_Click"
                                    Text="Opslaan" CssClass="styledButton styledButton75 floatLeft" />
                                <div class="remarklist">
                                    <asp:Repeater ID="rptTrafficComments" runat="server" OnItemDataBound="rptTrafficComments_ItemDataBound"
                                        OnItemCommand="rptTrafficComments_ItemCommand">
                                        <ItemTemplate>
                                            <asp:Label ID="lblId" runat="server" Text='<%#Eval("id")%>' Visible="false"></asp:Label>
                                            <div class="tag_remark">
                                                <p class="meta">
                                                    <strong>
                                                        <%# Eval("name") %>
                                                        [<%# Eval("organizationname") %>]</strong> <small>
                                                            <%# Eval("date") %></small>:
                                                    <asp:Button ID="btnEdit" runat="server" Visible="false" Text="Edit" UseSubmitBehavior="false"
                                                        CssClass="edit" />
                                                </p>
                                                <p class="comment">
                                                    <%# Eval("comments") %>
                                                </p>
                                                <div class="comment_edit" style="display: none;" id="txtTrafficCommentBox" runat="server">
                                                    <asp:TextBox ID="txtTrafficComment" runat="server" TextMode="MultiLine" Text='<%#Eval("comments")%>'></asp:TextBox>
                                                    <asp:Button ID="btnTrafficUpdate" runat="Server" Text="Update" CommandName="UpdateTrafficComments"
                                                        CssClass="styledButton styledButton75 floatLeft" />
                                                </div>
                                            </div>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                </div>
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="btnAddTrafficComments" EventName="Click" />
                            </Triggers>
                        </asp:UpdatePanel>
                    </div>
                </dd>
            </dl>
            <asp:Button runat="server" ID="btnExporteerGegevens" Text="Exporteer gegevens" CssClass="styledButton styledButton150" />

            <script type="text/javascript">
                workflow.accordion2.Init('#DetailExtended')
            </script>

        </div>
    </div>
</div>

<script type="text/javascript">
    jQuery(document).ready(function() {
        workflow.form.radioButtonCtrl.SetupLabel();
        workflow.form.checkboxCtrl.SetupLabel();
        workflow.alertDetails.ShowHideDetails('input.tag_showHideDetails', 'div.tag_detailExtendedBox')
    }); 
</script>

<script type="text/javascript">
    function RefreshParent() {
        window.parent.location.href = window.parent.location.href;
    }
</script>

<style type="text/css">
    .area_show
    {
        display: block !important;
    }
</style>

<script type="text/javascript">
    jQuery(document).ready(function() {
        workflow.form.select.Init(".js_hiddenDropdown:not(.init)");
        jQuery("a.rcCalPopup").not(".rcDisabled").click(function() {
            setTimeout(function() {
                var docWidth = jQuery(document).width();
                var calWidth = jQuery(".RadCalendar_workflow").width();
                var leftOffset = (docWidth - calWidth) / 2;
                jQuery(".RadCalendarPopup").css({
                    "left": leftOffset,
                    "top": "0"
                });
            }, 50);
        });
        jQuery(".rcMainTable tbody td").click(function() {
            jQuery(".RadCalendarPopup").fadeOut("fast");
        });
    });

    function RowClick(sender, args) {
        currentRowIndex = args.get_gridDataItem().get_element().rowIndex;
    }

    function RowCreated(sender, args) { }

    function Show(arg) {
        var obj = jQuery("#" + arg);

        if (obj.hasClass('area_show')) {
            obj.removeClass('area_show');
        }
        else {
            obj.addClass('area_show');
        }
    }
  
</script>

<script type="text/javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);

    function pageLoaded(sender, args) {
        workflow.form.checkboxCtrl.SetupLabel();
    }
</script>

